﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace EcssTool.Utility
{
    public class InputHelper
    {
        private List<string> targets;

        /// <summary>
        /// 从TextBox里面拆分出目标对象来
        /// </summary>
        /// <param name="textbox"></param>
        /// <returns></returns>
        public List<string> GetTargetInTextBox(TextBox textbox)
        {
            targets = new List<string>();

            if (!string.IsNullOrEmpty(textbox.Text.Trim()) && textbox.Lines.Count() > 0)
            {
                for (int i = 0; i < textbox.Lines.Count(); i++)
                {
                    string target = textbox.Lines[i];
                    if (string.IsNullOrEmpty(target)) { continue; }
                    else
                    {
                        targets.Add(target);
                    }
                }

                return targets;
            }
            else
            {
                return null;
            }
        }
    }
}
